<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Login
 *
 * @author Kam
 */
class Application_Form_User_ChangePassword extends My_Form {

    public function init() {
        $this->setTitle($this->translate('XXX_CHANGE_PASSWORD_FORM_TITLE'));
        $this->showLabels(true);

        $oldPassword = new Zend_Form_Element_Password('oldPassword');
        $oldPassword->setLabel(_('XXX_CHANGE_PASSWORD_FORM_OLD_PASS_LABEL'));
        $oldPassword->setAttrib('placeholder', $this->_('XXX_CHANGE_PASSWORD_FORM_OLD_PASS_LABEL'));
        $oldPassword->setRequired();
        $oldPassword->addValidator(new My_Validate_Password());
        $this->addElement($oldPassword);

        $newPassword = new Zend_Form_Element_Password('newPassword');
        $newPassword->setLabel(_('XXX_CHANGE_PASSWORD_FORM_NEW_PASS_LABEL'));
        $newPassword->setAttrib('placeholder', $this->_('XXX_CHANGE_PASSWORD_FORM_NEW_PASS_LABEL'));
        $newPassword->setRequired();
        $this->addElement($newPassword);

        $confirmedPassword = new Zend_Form_Element_Password('confirmedPassword');
        $confirmedPassword->setLabel(_('XXX_CHANGE_PASSWORD_FORM_NEW_PASS_CONFIRM_LABEL'));
        $confirmedPassword->setAttrib('placeholder', $this->_('XXX_CHANGE_PASSWORD_FORM_NEW_PASS_CONFIRM_LABEL'));
        $confirmedPassword->setRequired();
        $confirmedPassword->addValidator('Identical', false, array('token' => 'newPassword'));
        $this->addElement($confirmedPassword);
        
        $btn = $this->addSubmitElement()->setLabel(_('XXX_CHANGE_PASSWORD_FORM_BUTTON'));
        $class = $btn->getAttrib('class');
        $btn->setAttrib('class', $class . ' span12');
    }

}

